import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class SimpleButton extends StatelessWidget{

  //点击功能
  Function onPressed;
  Function onLongPressed;
  //子组件
  Widget child;
  double elevation=0;
  Color backgroundColor;
  Color foregroundColor;
  Color overlayColor;
  Color shadowColor;
  BorderSide borderSide;
  BorderRadius borderRadius;
  EdgeInsetsGeometry padding=EdgeInsets.only();
  EdgeInsetsGeometry margin=EdgeInsets.only();
  TextStyle textStyle=TextStyle();
  Size maximumSize;
  Size minimumSize;
  AlignmentGeometry alignment;
  Duration animationDuration;

  SimpleButton({
    this.onPressed,
    this.onLongPressed,
    this.child,

    this.elevation,
    this.backgroundColor,
    this.foregroundColor,
    this.overlayColor,
    this.shadowColor,
    this.borderSide,
    this.borderRadius,
    this.padding,
    this.margin,
    this.textStyle,
    this.maximumSize,
    this.minimumSize,
    this.alignment,
    this.animationDuration,

  });

  @override
  Widget build(BuildContext context) {

    return Container(
      margin: margin??EdgeInsets.only(),
      padding: EdgeInsets.only(),
      child: ElevatedButton(
        style: ButtonStyle(
          elevation: MaterialStateProperty.all(elevation??0),
          backgroundColor: MaterialStateProperty.all(backgroundColor??Colors.blue),
          foregroundColor: MaterialStateProperty.all(foregroundColor),
          overlayColor: MaterialStateProperty.all(overlayColor),
          shadowColor: MaterialStateProperty.all(shadowColor),
          maximumSize: MaterialStateProperty.all(maximumSize),
          minimumSize: MaterialStateProperty.all(minimumSize),
          alignment: alignment,
          animationDuration: animationDuration,
          shape: MaterialStateProperty.all(RoundedRectangleBorder(
              borderRadius: borderRadius??BorderRadius.circular(5),
              side: borderSide??BorderSide(width: 0,color: Colors.transparent)
          )),
          padding:MaterialStateProperty.all(padding??EdgeInsets.only()),
          textStyle: MaterialStateProperty.all(textStyle),

        ),
        onLongPress: (onLongPressed==null)?null:()=>onLongPressed(),
        onPressed: (onPressed==null)?null:()=>onPressed(),
        child: child,
      ),
    );
      // InkWell(
      //   onTap: (onPressed==null)?null:()=>onPressed(),
      //   child: child,
      // );
  }
}